//
//  PartyerShowCell.m
//  UESTCPioneer
//
//  Created by Apple on 14-9-25.
//  Copyright (c) 2014年 Sway. All rights reserved.
//

#import "PartyerShowCell.h"

@implementation PartyerShowCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubviews];
    }
    return self;
}

-(void)addSubviews{
    
    //1.添加头像
    _headImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 70, 70)];
    [self addSubview:_headImageView];
    _headImageView.contentMode = UIViewContentModeScaleAspectFill;
    _headImageView.clipsToBounds = YES;
    
    //2.添加内容label
    CGFloat x = CGRectGetMaxX(_headImageView.frame) + 10;
    CGFloat w = self.frame.size.width - 50 - _headImageView.frame.size.width;
    CGFloat h = self.frame.size.height - 20;
    _contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, 10, w, h)];
    [_contentLabel setFont:[UIFont systemFontOfSize:14.0f]];
    _contentLabel.textColor = [UIColor grayColor];
    _contentLabel.numberOfLines = 0;
    _contentLabel.lineBreakMode = NSLineBreakByWordWrapping;
    [self addSubview:_contentLabel];
    
}

-(void)setContentLabel:(UILabel *)contentLabel{
    _contentLabel.frame = contentLabel.frame;
    [_contentLabel setFont:[UIFont systemFontOfSize:14.0f]];
    _contentLabel.textColor = [UIColor grayColor];
    _contentLabel.numberOfLines = 0;
    _contentLabel.lineBreakMode = NSLineBreakByWordWrapping;
    [self addSubview:_contentLabel];
}

-(void)setImageName:(NSString *)imageName{
    _imageName = imageName;
    NSURL * imageURL = [NSURL URLWithString:_imageName];
    [_headImageView setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"image_default_big.png"] options:SDWebImageLowPriority | SDWebImageRetryFailed];
}

-(void)setHeight:(CGFloat)height{
    
    CGFloat x = CGRectGetMaxX(_headImageView.frame) + 10;
    CGFloat w = self.frame.size.width - 90 - _headImageView.frame.size.width;
    CGFloat h = height - 20;
    _contentLabel.frame = CGRectMake(x, 10, w, h);
}

-(void)setHeight{


}
- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
